

require(["config"],function(){
	require(["jquery","own","com"],function(jquery,own,com){
		com(own);
		var src = own.getCookie("xq");
		$(".detail_left_dq").attr({"src":src});
		$("#fxgwc").attr({"src":src})
		$(".detail_left_box ul li").hover(function(){
			var now = $(this).index();
			$(this).children("img").css({"border-color":"#000"});
			$(".detail_left_img").children("img").eq(now).addClass("detail_left_dq").siblings().removeClass("detail_left_dq");
			$(".detail_left_xs").children("img").eq(now).addClass("detail_left_dq").siblings().removeClass("detail_left_dq");
		},function(){
			$(this).children("img").css({"border-color":"#ccc"});
		})
		$(".detail_left_btnL").on("click",function(){
			var l = $(".detail_left_box ul li").length;
			var left = $(".detail_left_box ul").position().left - 84;
			if(left <= 0){
				left = 0;
			}
			$(".detail_left_box ul").stop().animate({"left":left},300);
		})
		$(".detail_left_btnR").on("click",function(){
			var l = $(".detail_left_box ul li").length - 4;
			var left = (-84 * l) + "px";
			$(".detail_left_box ul").stop().animate({"left":left},300)
		})
		$(".detail_left_img").hover(function(){
			$(".detail_left_xs").css({"display":"block"});
			$(".detail_left_zzc").css({"display":"block"});
		},function(){
			$(".detail_left_xs").css({"display":"none"});
			$(".detail_left_zzc").css({"display":"none"});
		})
		$(".detail_left_img").mousemove(function(eve){
			var x = eve.pageX - $(this).offset().left;
			var y = eve.pageY - $(this).offset().top;;
			var maxW = $(this).width() - $(".detail_left_zzc").width() -2;
			var maxH = $(this).height() - $(".detail_left_zzc").height() -2;
			x = x - $(".detail_left_zzc").width() / 2;
			y = y - $(".detail_left_zzc").height() / 2
			if(x <= 0){
				x = 0;
			}
			if(x >= maxW){
				x = maxW;
			}
			if(y <= 0){
				y = 0;
			}
			if(y >= maxH){
				y = maxH;
			}
			$(".detail_left_zzc").css({"left":x + "px","top":y + "px"});
			$(".detail_left_xs").children("img").css({"left":-2 * x + "px","top":-2 * y + "px"})
		})
		$(".detail_right_gg li").hover(function(){
			$(this).css({"border-color":"red"})
		},function(){
			$(this).css({"border-color":"#ccc"})
		})
		$(".detail_right_xz li").click(function(){
			$(this).css({"border-color":"red"}).siblings().css({"border-color":"#ccc"});
		})
		$("#detail_btnjia").on("click",function(){
			var v = $("#shuliang").val();
			v++;
			$("#shuliang").val(v);
		})
		$("#detail_btnjian").on("click",function(){
			var v = $("#shuliang").val();
			if(v == 1){
				v = 1;
			}else{
				v--;
			}
			$("#shuliang").val(v);
		})
		$(".gwc").hover(function(){
			$(this).css({"background-position":"0 -244px"});
		},function(){
			$(this).css({"background-position":"0 -201px"});
		})
		$(".hddb").hover(function(){
			$(this).css({"background-position":"0 -330px"});
		},function(){
			$(this).css({"background-position":"0 -287px"});
		})
		$(window).scroll(function(){
			var top = $(this).scrollTop();
			if(top > 200){
				$(".hddb").fadeIn();
			}else{
				$(".hddb").fadeOut();
			}
		})
		$(".hddb").on("click",function(){
			$("html,body").animate({"scrollTop":"0"},500);
		})
	})
})
